import logging

import settings
import connector.connector


def init():
    logger = logging.getLogger(settings.log_name_applog)
    filepath = settings.app_log_path + 'log_' + connector.connector.get_date() + '.txt'
    formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')

    logger.setLevel(logging.INFO)
    fhandler = logging.FileHandler(filepath)
    fhandler.setFormatter(formatter)
    logger.addHandler(fhandler)


if __name__ == '__main__':
    init()